# ~*~ coding: utf-8 ~*~
from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import InputRequired

from apps.common.form import ErrorFormMinx

__all__ = ['TaskForm']


class TaskForm(ErrorFormMinx, FlaskForm):
    title = StringField()
    content = StringField()
    tag = StringField()
    branch = StringField()
    commit = StringField()
    project_id = StringField()

    class Meta:
        csrf = True

    @property
    def data(self):
        return {
            'title': self.title.data,
            'content': self.content.data,
            'tag': self.tag.data,
            'branch': self.branch.data,
            'commit': self.commit.data,
            'project_id': self.project_id.data,
        }
